function* genNums() {
  yield 10;
  yield 20;
  yield 30;
}

const gtor = genNums();
console.log(gtor.next()); // { value: 10, done: false }
console.log(gtor.next()); // { value: 20, done: false }
console.log(gtor.next()); // { value: 30, done: false }
console.log(gtor.next()); // { value: undefined, done: true }

// for (let n of gtor) {
//   console.log(n); // 10 20 30
// }

// yield*
// const gener = [10, 20, 30];
// function* foo() {
//   yield* gener; // 相当于 yield 10 yield 20 yield 30
// }
